import request from '@/utils/request.ts';
import {ILoginParams,IDeptSearchParams,IDept,IUser,ICreateUserParams
,IReportData,ILineData,IPieData,IRadarData} from "@/types/api.ts";

export default {
  // 登录
  login(params:ILoginParams) {
    return request.post('/users/login', params);
  },
  // 获取用户信息
  getUserInfo() {
    return request.get<IUser>('/users/getUserInfo');
  },
  // 获取部门列表
  getDeptList(params?: IDeptSearchParams) {
    return request.get<IDept[]>('/dept/list', params);
  },
  // 获取用户模块
  getAllUserList() {
    return request.get<IUser[]>('/users/all/list');
  },
  // 创建用户
  createUser(params: ICreateUserParams) {
    return request.post('/users/create', params);
  },
  // 修改部门
  updateDept(params: IDept) {
    return request.post('/dept/edit', params);
  },
  // 删除部门
  deleteDept(params: { _id: string }) {
    return request.post('/dept/delete', params);
  },
  // dashboard 模块

  getReportData() {
    return request.get<IReportData>('/order/dashboard/getReportData');
  },
  getLineData() {
    return request.get<ILineData>('/order/dashboard/getLineData');
  },
  getPieCityData() {
    return request.get<IPieData>('/order/dashboard/getPieCityData');
  },
  getPieAgeData() {
    return request.get<IPieData>('/order/dashboard/getPieAgeData');
  },
  getRadarData() {
    return request.get<IRadarData>('/order/dashboard/getRadarData');
  },
}

